﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Rappelz.GameServer
{
    public class DungeonManager
    {
        /// <summary>
        /// The instance!
        /// </summary>
        protected static DungeonManager m_instance;

        /// <summary>
        /// Returns the instance
        /// </summary>
        public static DungeonManager Instance
        {
            get
            {
                if (m_instance == null)
                    m_instance = new DungeonManager();
                return m_instance;
            }
        }

// UserDefinedType: DungeonManager
// BaseClass      :   ArSchedulerObject, offset = 0x0
// 
// Enum           :   <unnamed-tag>, Type: int
// Data           :     constant 0x1, Constant, Type: int, DUNGEON_SIEGE_LAYER
// Data           :     constant 0xFF, Constant, Type: int, CUSTOMIZE_DUNGEON_LAYER
// Function       :   public bool DungeonManager::Init()
// Function       :   public bool DungeonManager::DeInit()
// Function       :   public static struct DungeonManager & DungeonManager::Instance()
// Function       :   public static __int64 DungeonManager::GetDungeonRaidStartTime(int)
// Function       :   public static __int64 DungeonManager::GetDungeonRaidEndTime(int)
// Function       :   public static __int64 DungeonManager::GetNextDungeonSiegeStartTime(int, __int64)
// Function       :   public static __int64 DungeonManager::GetNextDungeonSiegeEndTime(int, __int64)
// Function       :   public void DungeonManager::onProcess(int)
        public ArPosition GetRaidStartPosition(int nDungeonID)
        {
            foreach (DungeonInfo di in this.m_vDungeonInfo)
            {
                if(di.id == nDungeonID)
                    return di.raid_start_pos;
            }
            return new ArPosition();
        }

        public ArPosition GetSiegeStartPosition(int nDungeonID)
        {
            return null;
        }

        public ArPosition GetSiegeDefencePosition(int nDungeonID)
        {
            return null;
        }


        public int GetOriginalOwnGuildID(int nDungeonID)
        {
            return 0;
        }

        public int GetOwnGuildID(int nDungeonID)
        {
            return 0;
        }
// Function       :   public bool DungeonManager::SetOwnGuildID(const int &, const int &)
// Function       :   public bool ClearRaidGuildID(const int &)

        public int GetRaidGuildID(int nDungeonID)
        {
            return 0;
        }
// Function       :   public int DungeonManager::GetDungeonID(float, float)
        public int GetDungeonID(float x, float y)
        {
            foreach (DungeonInfo di in this.m_vDungeonInfo)
            {
                if(di.box.IsInclude(x,y))
                    return di.id;
            }
            return 0;
        }
// Function       :   public int DungeonManager::GetDungeonLevel(int)
// Function       :   public int DungeonManager::GetMaxRaidParty(int)
// Function       :   public int DungeonManager::GetMaxGuildParty(int)
// Function       :   public bool DungeonManager::BeginDungeonRaid(int, int)
        public byte GetRaidDungeonLayer(int nDungeonID, int nGuildID)
        {
            return 0;
        }

        public bool IsRaidBegin(int nDungeonID, int nGuildID)
        {
            return false;
        }

        public bool IsDungeonRaidTime(int nDungeonID)
        {
            return false;
        }
// Function       :   public bool DungeonManager::IsDungeonSiegeAttacteamMakingPeriod(int)
// Function       :   public void DungeonManager::CreateDungeonSiege(int)
// Function       :   public void DungeonManager::BeginDungeonSiege(int)
// Function       :   public void EndDungeonSiege(int)
// Function       :   public bool DungeonManager::DropDungeonOwnership(int)
// Function       :   public bool IsOwner(int)

        public bool IsOwner(int nDungeonID, int nTacticalPositionID, int nGuildID)
        {
            return false;
        }
// Function       :   public bool DungeonManager::IsCoreInvincible(int)
// Function       :   public void DungeonManager::ClearDungeonSiegeCoreGuardian(int)
// Function       :   public void DungeonManager::ChangeOwner(int, int)
// Function       :   public void DungeonManager::PendRespawnGuardian(int, int)
// Function       :   public void DungeonManager::SetTaxRate(int, int)

        public void GetTaxRate(int nDungeonID, out int nTaxRate, out int nOwnGuildID)
        {
            foreach (DungeonInfo di in this.m_vDungeonInfo)
            {
                if(di.id == nDungeonID)
                {
                    nTaxRate = di.tax_rate;
                    nOwnGuildID = di.owner_guild_id;
                    return;
                }
            }
            nTaxRate = 0;
            nOwnGuildID = 0;
        }

// Function       :   public unsigned long DungeonManager::GetDungeonRaidRecord(int, int)
// Function       :   public void DungeonManager::ClearDungeonRaidRecord(int, int)
// Function       :   public __int64 DungeonManager::GetLastRaidEndTime(int, int)
// Function       :   public void DungeonManager::AddToDungeonRaidMonster(struct StructMonster *, int, unsigned char)

        public ArPosition GetNearestTacticalPosition(int nDungeonID, int nGuildID, ArPosition curPos)
        {
            return new ArPosition();
        }

        public bool IsSiegeBegin(int nDungeonID)
        {
            return false;
        }

        public bool IsEnterableSiegeDungeon(int nDungeonID, int nGuildID)
        {
            return false;
        }
// Function       :   public static const char DungeonManager::IsRestrictedToEnter(const int, const int, const bool)

        public byte IsRestrictedToEnter(int nDungeonID, Creature pCreature, bool bAllowLowLevel)
        {
            return 0;
        }

        public void RegisterDungeonInfo(int id, int level, float raid_start_x, float raid_start_y, float siege_start_x, float siege_start_y, float siege_defence_x, float siege_defence_y, int connector_id, float connector_x, float connector_y, int core_id, float core_x, float core_y, float core_offset_z, float core_around_x, float core_around_y, float core_around_z, float scale_x, float scale_y, float scale_z, bool core_is_lock_height, float core_lock_height, int boss01_id, int boss02_id, int raid_start_time, int raid_end_time, int start_time, int end_time, X2D.Boxf box, int owner_guild_id, int raid_guild_id, int best_raid_time, int last_dungeon_siege_finish_time, int last_dungeon_raid_wrap_up_time, int tax_rate, int max_guild_party, int max_raid_party)
        {
            DungeonInfo info = new DungeonInfo();
            info.id = id;
            info.level = level;
            info.raid_start_pos = new ArPosition(raid_start_x,raid_start_y,0);
            info.siege_start_pos = new ArPosition(siege_start_x,siege_start_y,0);
            info.siege_defence_pos = new ArPosition(siege_defence_x,siege_defence_y,0);
            info.core_pos = new ArPosition(core_x,core_y,0);
            info.connector_pos = new ArPosition(connector_x,connector_y,0);
            info.core_id = core_id;
            info.start_time = start_time;
            info.end_time = end_time;
            info.raid_start_time = raid_start_time;
            info.raid_end_time = raid_end_time;
            info.core_offset_z = core_offset_z;
            info.core_around_x = core_around_x;
            info.core_around_y = core_around_y;
            info.core_around_z = core_around_z;
            info.core_scale_x = scale_x;
            info.core_scale_y = scale_y;
            info.core_scale_z = scale_z;
            info.core_is_lock_height = core_is_lock_height;
            info.core_lock_height = core_lock_height;
            info.boss_id[0] = boss01_id;
            info.boss_id[1] = boss02_id;
            info.box = box;
            info.connector_id = connector_id;
            info.owner_guild_id = owner_guild_id;
            info.raid_guild_id = raid_guild_id;
            info.best_raid_time = (uint)best_raid_time;
            info.original_owner_guild_id = owner_guild_id;
            info.last_global_notice_time = 0;
            info.last_dungeon_siege_finish_time = last_dungeon_siege_finish_time;
            info.last_dungeon_raid_wrap_up_time = last_dungeon_raid_wrap_up_time;
            info.max_guild_party = max_guild_party;
            info.max_raid_party = max_raid_party;
            info.tax_rate = tax_rate;
            info.bDungeonSiegeKicked = true;

            this.m_vDungeonInfo.Add(info);
        }

// Function       :   public void DungeonManager::RegisterDungeonMonsterRespawnInfo(int, const struct GameContent::MONSTER_RESPAWN_INFO &)
// Function       :   public void DungeonManager::RegisterDungeonGuardianRespawnInfo(int, const struct GameContent::MONSTER_RESPAWN_INFO &)
// Function       :   public void DungeonManager::RegisterDungeonEnvironmentalGuardianRespawnInfo(int, const struct GameContent::MONSTER_RESPAWN_INFO &)
// Function       :   public void DungeonManager::RegisterDungeonRoamerInfo(int, const int)
// Function       :   public void DungeonManager::RegisterDungeonRaidInfo(int, int, unsigned long, __int64)
// Function       :   public void DungeonManager::RegisterTacticalPositionInfo(int, int, float, float, int)
// Function       :   public void DungeonManager::LoadAllRaidInfo()
// Function       :   public void DungeonManager::~DungeonManager()
// Function       :   public void DungeonManager(const struct DungeonManager &)
// Function       :   protected void DungeonManager::DungeonManager()
// Function       :   protected void DungeonManager::LoadRaidInfo(int, int)
// Function       :   protected bool DungeonManager::beginDungeonRaid(struct _DUNGEON_RAID_INFO *)
// Function       :   protected bool DungeonManager::endDungeonRaid(struct _DUNGEON_RAID_INFO *, bool)
// Function       :   protected void DungeonManager::RespawnGuardian(struct _DUNGEON_INFO *, int)
// Function       :   protected void DungeonManager::kickPlayerInDungeon(struct _DUNGEON_INFO *, unsigned char)
// Function       :   protected void DungeonManager::endDungeonSiege(struct _DUNGEON_INFO *)
// Function       :   protected void DungeonManager::changePosition(struct _DUNGEON_INFO *)
// Function       :   protected unsigned long DungeonManager::getDungeonRaidRecord(struct _DUNGEON_INFO *, int)
// Function       :   protected void DungeonManager::clearDungeonRaidRecord(struct _DUNGEON_INFO *, int)
// Function       :   protected void DungeonManager::notice(struct _DUNGEON_INFO *)
// Function       :   protected void DungeonManager::wrapUpDungeonRaid(struct _DUNGEON_INFO *)
// Function       :   protected void DungeonManager::wrapUpDungeonSiege(struct _DUNGEON_INFO *)
        public List<DungeonInfo> m_vDungeonInfo = new List<DungeonInfo>();
// Data           :   this+0x40, Member, Type: class std::vector<_DUNGEON_INFO,std::allocator<_DUNGEON_INFO> >, m_vDungeonInfo
// UserDefinedType:     std::vector<_DUNGEON_INFO,std::allocator<_DUNGEON_INFO> >
// 
// Function       :   public struct DungeonManager & operator=(const struct DungeonManager &)
// Function       :   public void __local_vftable_ctor_closure()
// Function       :   public void * __vecDelDtor(unsigned int)


    }
}
